<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core">
<body>
<ui:composition template="../template/adminTemplate.jsp">
	<ui:define name="title">
		Edit User
	</ui:define>
	<ui:define name="body">
		<h:form id="userForm">
			<h:messages layout="table" styleClass="error" />
			<h:panelGrid id="panel" columns="2">
				<f:facet name="header">
					<h:outputText value="User" />
				</f:facet>
	
				<h:outputText value="Username" />
				<h:inputText value="#{userBackingBean.user.username}" id="usernameInput" rendered="#{userBackingBean.password.newUser}" />
				<h:outputText value="#{userBackingBean.user.username}" id="usernameOutput" rendered="#{!userBackingBean.password.newUser}" />
				
				<h:outputText value="Password" />
				<h:inputSecret value="#{userBackingBean.password.password}" id="password" />
				
				<h:outputText value="Confirmation" />
				<h:inputSecret value="#{userBackingBean.password.passwordConfirmation}" id="passwordConfirmation" />
				
				<h:outputText value="Roles" />
				<h:selectManyListbox value="#{userBackingBean.roles}"  required="true" >
					<f:selectItems value="#{userBackingBean.allRoles}" />
				</h:selectManyListbox>
					
				<h:outputText value="Account Enabled" />
				<h:selectBooleanCheckbox value="#{userBackingBean.user.enabled}" id="enabled" />
				
				<h:outputText value="Account Not Locked" />
				<h:selectBooleanCheckbox  value="#{userBackingBean.user.accountNonLocked}" id="locked" />
				
				<h:outputText value="Account Not Expired" />
				<h:selectBooleanCheckbox value="#{userBackingBean.user.accountNonExpired}" id="expired" />
				
				<f:facet name="footer">
					<h:panelGroup>
						<h:commandButton action="#{userBackingBean.saveUser}" value="Save" />
						<h:commandButton action="#{userBackingBean.cancelUser}" value="Cancel" />
					</h:panelGroup>
				</f:facet>
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
</body>
</html>
